<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>table</title>
</head>

<body>
    <style>
        tbody>tr:nth-child(2n) {
            background: gray;
        }

        tbody>tr:nth-child(2n + 1) {
            background: #fff;
        }

        tbody>tr:hover {
            background: yellow;
        }

        table {
            border-collapse: collapse;
            border-spacing: 0;
        }

        th,
        td {
            padding: 0;
        }
    </style>
    <table>

        <thead>
            <tr>
                <th>班级</th>
                <th>姓名</th>
            </tr>

        </thead>
        <tbody>
            <tr>
                <td>1班</td>
                <td>张三</td>
            </tr>
            <tr>
                <td>1班</td>
                <td>张三</td>
            </tr>
            <tr>
                <td>1班</td>
                <td>张三</td>
            </tr>
            <tr>
                <td>1班</td>
                <td>张三</td>
            </tr>
            <tr>
                <td>1班</td>
                <td>张三</td>
            </tr>
        </tbody>

    </table>
</body>

</html>